package edu.spec.sms.model.questionnaire;

import edu.spec.sys.model.User;
import edu.spec.sys.model.enumeration.Status;

import javax.persistence.*;
import java.util.Date;

/**
 * 问卷调查
 * 里面具体题目和Subject对应
 * 由管理员创建
 */
@Entity
@Table(name = "t_questionnaire")
public class Questionnaire {
    /**
     * 主键
     */
    private int id;
    /**
     * 问卷调查的名字，比如“2017-2018下学期教学满意度调查”
     */
    private String name;
    /**
     * 问卷调查的状态，用于控制该问卷对学生的可见性
     */
    private Status status;
    /**
     * 问卷调查的描述，备注说明的意思
     */
    private String description;
    /**
     * 创建时间，用户创建时候，设置成当前服务器时间
     */
    private Date createDate;
    /**
     * 截止时间，截止后，问卷对学生将不可见
     */
    private Date closeDate;
    /**
     * 创建人
     */
    private User creator;

    public Questionnaire() {
    }

    @Id
    @GeneratedValue
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Status getStatus() {
        return status;
    }

    public void setStatus(Status status) {
        this.status = status;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Column(name = "create_date")
    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    @Column(name = "close_date")
    public Date getCloseDate() {
        return closeDate;
    }

    public void setCloseDate(Date closeDate) {
        this.closeDate = closeDate;
    }

    @ManyToOne
    @JoinColumn(name = "creator_id")
    public User getCreator() {
        return creator;
    }

    public void setCreator(User creator) {
        this.creator = creator;
    }
}
